using UnityEngine;
using System.Collections.Generic;

public class ObjectManager<T,F>
{

    private Dictionary<T, F> m_objects;
    private ObjectManager<T, F> m_Instance;
    
    public ObjectManager<T, F> Instance
    {
        get
        {
            if (m_Instance != null)
                return m_Instance;
            else
                m_Instance = new ObjectManager<T, F>();
            return m_Instance;
        }
    }

    public void Initalize()
    {
        m_objects = new Dictionary<T, F>();
    }

    public void AddObject(T name, F item)
    {
        if (!m_objects.ContainsKey(name))
            m_objects.Add(name,item);
    }
    public void Remove(T name)
    {
        if (m_objects.ContainsKey(name))
            m_objects.Remove(name);
    }
    public void Shutdown()
    {
        m_objects.Clear();
    }
}